package org.googlecode.jwf.demo;

import java.awt.BorderLayout;
import java.awt.GridLayout;

import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JProgressBar;

public class ProcessPanel extends JPanel {

    private JProgressBar progressSent_;

    private JLabel progressDescription_;

    public ProcessPanel() {
        setupUI();
    }

    public void setProgressText(String s) {
        progressDescription_.setText(s);
    }

    public void setProgressValue(int i) {
        progressSent_.setValue(i);
    }

    private void setupUI() {
        setLayout(new BorderLayout());

        add(new JLabel("Now we will pretend to send this data"
                + " somewhere for approval..."), BorderLayout.NORTH);

        JPanel processPanel = new JPanel(new GridLayout(0, 1));

        processPanel.add(new JLabel());
        progressSent_ = new JProgressBar();
        progressSent_.setStringPainted(true);
        processPanel.add(progressSent_);
        progressDescription_ = new JLabel();
        processPanel.add(progressDescription_);
        processPanel.add(new JLabel());
        processPanel.add(new JLabel());

        add(processPanel, BorderLayout.CENTER);

        add(new JLabel("After the sending is completed, the Back and Finish"
                + " buttons will enable below."), BorderLayout.SOUTH);
    }
}
